$(function(){
    "use strict";
    // 进入页面获取信息
    $.ajax({
        url:'/Admin/ComInfo/comInfo',
        type:'get',
        success:function(data){
            console.log(data)
            let datas = data.res

            $('#CompanyInfoList').find('span[data-name=name]').html(datas.com_name)
            $('#CompanyInfoList').find('span[data-name=social_credit_code]').html(datas.com_code)
            $('#CompanyInfoList').find('input[data-name=Registration_number]').val(datas.reg_sn)
            $('#CompanyInfoList').find('input[data-name=Organization_number]').val(datas.org_code)
            $('#CompanyInfoList').find('input[data-name=Registered_capital]').val(datas.reg_money+'万')
            $('#CompanyInfoList').find('input[data-name=Registered_address]').val(datas.reg_addr)
            $('#CompanyInfoList').find('p[data-name=Scope_peration]').html(datas.active)
            $('#CompanyInfoList').find('textarea[data-name=Scope_peration]').val(datas.active)
            $('#CompanyInfoList').find('input[data-name=time]').val(datas.start_end)
            $('#CompanyInfoList').find('input[data-name=Administration]').val(datas.bureau_belong)
            $('#CompanyInfoList').find('p[data-name=OperatingState]').html(datas.status)
            $('#CompanyInfoList').find('select[data-name=OperatingState]').val(datas.status)
            $('#CompanyInfoList').find('input[data-name=industry]').val(datas.industry)
            $('#CompanyInfoList').find('input[data-name=Enterprise_address]').val(datas.area)
            $('#CompanyInfoList').find('input[data-name=Enterprise_people_number]').val(datas.total_staff)
            $('#CompanyInfoList').find('input[data-name=development_people_number]').val(datas.total_rp)
            $('#CompanyInfoList').find('p[data-name=technicalField]').html(datas.tec_name)
            $('#CompanyInfoList').find('select[data-name=technicalField]').val(datas.tec_id)
        }
    })

    //经营状态
    // $.ajax({
    //     url:'/Admin/ComInfo/comStatusList',
    //     type:'get',
    //     success:function (data) {
    //         console.log(data)
    //         let OperatingStateHTML = ''
    //         for(let osi=0;osi<data.res.length;osi++){
    //             OperatingStateHTML+=`<option>${data.res[osi]}</option>`
    //         }
    //         $('#CompanyInfoList').find('select[data-name=OperatingState]').html(OperatingStateHTML)
    //     }
    // })

    //技术领域
    $.ajax({
        url:'/Admin/ComInfo/comTecList',
        type:'get',
        success:function (data) {
            console.log(data)
            let technicalFieldHTML = ''
            for(let tfi=0;tfi<data.res.length;tfi++){
                technicalFieldHTML+=`<option value="${data.res[tfi].tec_id}">${data.res[tfi].tec_name}</option>`
            }
            $('#CompanyInfoList').find('select[data-name=technicalField]').html(technicalFieldHTML)
        }
    })

    //高新企业是否认证
    // $.ajax({
    //     url:'/Admin/ComInfo/CAStatus',
    //     type:'get',
    //     success:function(data){
    //         if(data.code==1){
    //             let g = data.res.hcom_check
    //             let x = data.res.lcom_check
    //             console.log(g)
    //             console.log(x)
    //
    //             $('#Authentication_List').find('[data-target="#BigCompanyModal"]')[0].classList = []
    //             $('#Authentication_List').find('[data-target="#BigCompanyModal"]')[0].classList.add('btn');
    //             $('#Authentication_List').find('[data-target="#BigCompanyModal"]')[0].classList.add('btn-sm');
    //             if(g==0){
    //                 $('#Authentication_List').find('[data-target="#BigCompanyModal"]')[0].classList.add('btn-default');
    //                 $('#Authentication_List').find('[data-target="#BigCompanyModal"]').html('未认证')
    //                 $('#Authentication_List').find('[data-target="#BigCompanyModal"]').attr('data-toggle','modal')
    //             }else if(g==1){
    //                 $('#Authentication_List').find('[data-target="#BigCompanyModal"]')[0].classList.add('btn-warning');
    //                 $('#Authentication_List').find('[data-target="#BigCompanyModal"]').html('认证中')
    //                 $('#Authentication_List').find('[data-target="#BigCompanyModal"]').attr('data-toggle','')
    //             }else if(g==2){
    //                 $('#Authentication_List').find('[data-target="#BigCompanyModal"]')[0].classList.add('btn-danger');
    //                 $('#Authentication_List').find('[data-target="#BigCompanyModal"]').html('认证失败')
    //                 $('#Authentication_List').find('[data-target="#BigCompanyModal"]').attr('data-toggle','modal')
    //             }else{
    //                 $('#Authentication_List').find('[data-target="#BigCompanyModal"]')[0].classList.add('btn-success')
    //                 $('#Authentication_List').find('[data-target="#BigCompanyModal"]').html('认证成功')
    //                 $('#Authentication_List').find('[data-target="#BigCompanyModal"]').attr('data-toggle','')
    //             }
    //
    //             $('#Authentication_List').find('[data-target="#smallCompanyModal"]')[0].classList = []
    //             $('#Authentication_List').find('[data-target="#smallCompanyModal"]')[0].classList.add('btn');
    //             $('#Authentication_List').find('[data-target="#smallCompanyModal"]')[0].classList.add('btn-sm');
    //             if(x==0){
    //                 $('#Authentication_List').find('[data-target="#smallCompanyModal"]')[0].classList.add('btn-default');
    //                 $('#Authentication_List').find('[data-target="#smallCompanyModal"]').html('未认证')
    //                 $('#Authentication_List').find('[data-target="#smallCompanyModal"]').attr('data-toggle','modal')
    //             }else if(x==1){
    //                 $('#Authentication_List').find('[data-target="#smallCompanyModal"]')[0].classList.add('btn-warning');
    //                 $('#Authentication_List').find('[data-target="#smallCompanyModal"]').html('认证中')
    //                 $('#Authentication_List').find('[data-target="#smallCompanyModal"]').attr('data-toggle','')
    //             }else if(x==2){
    //                 $('#Authentication_List').find('[data-target="#smallCompanyModal"]')[0].classList.add('btn-danger');
    //                 $('#Authentication_List').find('[data-target="#smallCompanyModal"]').html('认证失败')
    //                 $('#Authentication_List').find('[data-target="#smallCompanyModal"]').attr('data-toggle','modal')
    //             }else{
    //                 $('#Authentication_List').find('[data-target="#smallCompanyModal"]')[0].classList.add('btn-success')
    //                 $('#Authentication_List').find('[data-target="#smallCompanyModal"]').html('认证成功')
    //                 $('#Authentication_List').find('[data-target="#smallCompanyModal"]').attr('data-toggle','')
    //             }
    //         }
    //     }
    // })

    //显示企业股东信息
    $.ajax({
        url:'/Admin/ComInfo/shareInfo',
        type:'get',
        success:function(data){
            if(data.code==1){
                let datas = data.res;
                let htmls = ''
                for(let i=0;i<datas.length;i++){
                    htmls += `
                        <tr data-index="${datas[i].share_id}">
                            <td>${datas[i].share_holder}</td>
                            <td>${datas[i].share_ratio}</td>
                            <td>${datas[i].share_money}</td>
                            <!--<td>${datas[i].share_date}</td>-->
                            <td>${datas[i].share_holder_type_name}</td>
                            <td>
                                <a href="edit_people" class="edit_table">编辑</a>
                                <a href="delete" class="edit_table">删除</a>
                            </td>
                        </tr>
                    `
                }
                $('#Shareholder_table').children('tbody').html(htmls)
            }
        }
    })

    // 编辑和保存来回切换
    $('.modifyInfo_btn').click(function(e){
        e.preventDefault();
        $('.CompanyInfoList input').toggleClass('active');
        //当处于编辑时
        if($('.CompanyInfoList input').hasClass('active')){
            $('.CompanyInfoList input').attr('readonly',false);
            $(this).html('保存');
            $('.textarea_box>textarea').addClass('active');
            $('.textarea_box>p').removeClass('active');
            $('.select_box>select').addClass('active');
            $('.select_box>p').removeClass('active');

            $('#choose_time').children('input').addClass('time_choose');
            $('#choose_time').children('input').attr('disabled',false);
            // $('#time_choose').removeClass('time_choose')
            laydate.render({
                elem: '.time_choose', //指定元素
                theme: '#2881C1',
                show: true, //直接显示
                // range: true,
                closeStop: '#choose_time',
                done: function(value, date, endDate){
                    console.log(value)
//                    var time_choose = date.year+'年'+date.month+'月'+date.data+'日'
//                    window.add_time = dateVal
                }
            });


        }else{//当处于保存时
            let that = this
            let reg_sn = $('#CompanyInfoList').find('input[data-name=Registration_number]').val()
            let org_code = $('#CompanyInfoList').find('input[data-name=Organization_number]').val()
            let reg_money = $('#CompanyInfoList').find('input[data-name=Registered_capital]').val()
            let reg_addr = $('#CompanyInfoList').find('input[data-name=Registered_address]').val()
            let active = $('#CompanyInfoList').find('textarea[data-name=Scope_peration]').val()
            let start_end = $('#CompanyInfoList').find('input[data-name=time]').val()
            let bureau_belong = $('#CompanyInfoList').find('input[data-name=Administration]').val()
            let status = $('#CompanyInfoList').find('select[data-name=OperatingState]').val()
            let industry = $('#CompanyInfoList').find('input[data-name=industry]').val()
            let area = $('#CompanyInfoList').find('input[data-name=Enterprise_address]').val()
            let total_staff = $('#CompanyInfoList').find('input[data-name=Enterprise_people_number]').val()
            let total_rp = $('#CompanyInfoList').find('input[data-name=development_people_number]').val()
            let tec_name = $('#CompanyInfoList').find('select[data-name=technicalField]').val()
            $.ajax({
                url:'/Admin/ComInfo/comInfoModify',
                type:'post',
                data:{
                    reg_sn:reg_sn,
                    org_code:org_code,
                    reg_money:reg_money,
                    reg_addr:reg_addr,
                    active:active,
                    start_end:start_end,
                    bureau_belong:bureau_belong,
                    status:status,
                    industry:industry,
                    area:area,
                    total_staff:total_staff,
                    total_rp:total_rp,
                    tec_name:tec_name
                },
                success:function(data){
                    if(data.code==1){
                        $('.CompanyInfoList input').attr('readonly',true);
                        $(that).html('编辑');
                        let ManagementRangeVal = $('.textarea_box>textarea').val();
                        // let jyztVal = $('.select_box>select option:selected').text();
                        let status = $('#CompanyInfoList').find('select[data-name=OperatingState] option:selected').text()
                        let tec_name = $('#CompanyInfoList').find('select[data-name=technicalField] option:selected').text()
                        $('.textarea_box>p').html(ManagementRangeVal);

                        $('.textarea_box>textarea').removeClass('active');
                        $('.textarea_box>p').addClass('active');

                        // $('.select_box>p').html(jyztVal);
                        $('#CompanyInfoList').find('p[data-name=OperatingState]').html(status)
                        $('#CompanyInfoList').find('p[data-name=technicalField]').html(tec_name)
                        // console.log(11)
                        $('.select_box>select').removeClass('active');
                        $('.select_box>p').addClass('active');


                        $('#choose_time').children('input').removeClass('time_choose');
                        $('#choose_time').children('input').attr('disabled',true);
                    }
                }
            })
        }
    });

    /**
     * 上传照片
     * */
    //let G_renzheng_img//,X_renzheng_img
/*
    $('#BigCompanyModalhiddenUploadImageInput').on('change',function(){
        let data = this.files;
        for(var i =0;i<data.length;i++){
            let imgReader = new FileReader();
            imgReader.readAsDataURL(data[i]);
            imgReader.onload = function (e){
                $('#BigCompanyModalhiddenUploadImageInput').siblings('.uploadImage_box_style').removeClass('active');
                $('#BigCompanyModalhiddenUploadImageInput').siblings('.uploadImage_imgbox_style').addClass('active');
                let url = this.result;//上传文件的URL
                // let img_btnSrc = url.indexOf('4');
                // let img = url.substring(img_btnSrc + 2);
                let img = `<img src="${url}" alt="">`;
                $('#big_uploadImage_imgbox_style').html(img);
                // IMG_arr.unshift(img);
                // G_renzheng_img = url
                $('#big_progress').addClass('active')
                let n = 0
                $('#big_progress').children('div').css({'width':n+'%'})
                $('#big_progress').children('div').children('span').html(n+'%')
                // let propressBar
                let progressBar = setInterval(function(){
                    n+=5
                    // console.log(n)
                    // console.log($('#progress').children('div').attr('w'))
                    // $('#progress').children('div').attr('w',n)
                    $('#big_progress').children('div').css({'width':n+'%'})
                    $('#big_progress').children('div').children('span').html(n+'%')
                    if(n>85){
                        // console.log('ss：',n)
                        clearTimeout(progressBar)
                    }
                },150)
                // setTimeout()
                $.ajax({
                    url:'/Admin/ComInfo/HNTechCAImg',
                    type:'post',
                    data:{
                        hcom_img:url,
                        type:1
                    },
                    success:function(data){
                        if(data.code==1){
                            // $('#progress').children('div').attr('w',100)
                            $('#big_progress').children('div').css({'width':'100%','background-color':'green'})
                            $('#big_progress').children('div').children('span').html('100%')
                        }
                    }
                })
            }
        }
    });
    $('#smallCompanyModalhiddenUploadImageInput').on('change',function(){
        let data = this.files;
        for(var i =0;i<data.length;i++){
            let imgReader = new FileReader();
            imgReader.readAsDataURL(data[i]);
            imgReader.onload = function (e){
                $('#smallCompanyModalhiddenUploadImageInput').siblings('.uploadImage_box_style').removeClass('active');
                $('#smallCompanyModalhiddenUploadImageInput').siblings('.uploadImage_imgbox_style').addClass('active');
                let url = this.result;//上传文件的URL
                let img = `<img src="${url}" alt="">`;
                $('#small_uploadImage_imgbox_style').html(img);
                $('#small_progress').addClass('active')
                let n = 0
                $('#small_progress').children('div').css({'width':n+'%'})
                $('#small_progress').children('div').children('span').html(n+'%')
                let progressBar = setInterval(function(){
                    n+=5
                    $('#small_progress').children('div').css({'width':n+'%'})
                    $('#small_progress').children('div').children('span').html(n+'%')
                    if(n>85){
                        clearTimeout(progressBar)
                    }
                },150)
                $.ajax({
                    url:'/Admin/ComInfo/HNTechCAImg',
                    type:'post',
                    data:{
                        hcom_img:url,
                        type:2
                    },
                    success:function(data){
                        if(data.code==1){
                            $('#small_progress').children('div').css({'width':'100%','background-color':'green'})
                            $('#small_progress').children('div').children('span').html('100%')
                        }
                    }
                })
            }
        }
    });

    $('.G_renzheng_save_btn').click(function(){
        let G_num = $(this).parent().siblings().find('[data-name=G_num]').val()
        let G_time = $(this).parent().siblings().find('[data-name=G_time]').val()
        if(G_num == '' || G_time == '' || !$('#BigCompanyModalhiddenUploadImageInput').siblings('.uploadImage_imgbox_style').hasClass('active')){
            $('#yz_modal').html('您有内容没有填写完整！')
            $('#yz_modal').addClass('active')
            tipShow()
            return
        }else{
            $.ajax({
                url:'/Admin/ComInfo/HNTechCA',
                type:'post',
                data:{
                    // hcom_img:G_renzheng_img,
                    hcom_num:G_num,
                    hcom_se:G_time
                },
                success:function(data){
                    if(data.code==1){
                        $('#Authentication_List').find('[data-target="#BigCompanyModal"]')[0].classList = []
                        $('#Authentication_List').find('[data-target="#BigCompanyModal"]')[0].classList.add('btn');
                        $('#Authentication_List').find('[data-target="#BigCompanyModal"]')[0].classList.add('btn-sm');
                        $('#Authentication_List').find('[data-target="#BigCompanyModal"]')[0].classList.add('btn-warning');
                        $('#Authentication_List').find('[data-target="#BigCompanyModal"]').html('认证中')
                        $('#Authentication_List').find('[data-target="#BigCompanyModal"]').attr('data-toggle','')
                    }
                }
            })
        }
    })
    $('.X_renzheng_save_btn').click(function(){
        let X_num = $(this).parent().siblings().find('[data-name=X_num]').val()
        // let X_time = $(this).parent().siblings().find('[data-name=X_time]').val()
        if(X_num == ''){
            $('#yz_modal').html('证书编号还未填写！')
            $('#yz_modal').addClass('active')
            tipShow()
            return
        }else{
            $.ajax({
                url:'/Admin/ComInfo/SMTechCA',
                type:'post',
                data:{
                    // lcom_img:X_renzheng_img,
                    lcom_num:X_num
                    // lcom_se:X_time
                },
                success:function(data){
                    if(data.code==1){
                        $('#Authentication_List').find('[data-target="#smallCompanyModal"]')[0].classList = []
                        $('#Authentication_List').find('[data-target="#smallCompanyModal"]')[0].classList.add('btn');
                        $('#Authentication_List').find('[data-target="#smallCompanyModal"]')[0].classList.add('btn-sm');
                        $('#Authentication_List').find('[data-target="#smallCompanyModal"]')[0].classList.add('btn-warning');
                        $('#Authentication_List').find('[data-target="#smallCompanyModal"]').html('认证中')
                        $('#Authentication_List').find('[data-target="#smallCompanyModal"]').attr('data-toggle','')
                    }
                }
            })
        }
    })
*/

    /**
     * 保存上传
     */
    $('.save_btn').click(function (e) {
        e.preventDefault();

    })
    /*当点击添加按钮时*/
    $('.operation_btn').on('click','a',function(e){1
        e.preventDefault()
        if( $(this).html() == '添加' ){
            let add_people = $(this).attr('href')
            $.ajax({
                url:'/Admin/ComInfo/shareSumAndRemain',
                type:'post',
                success:function(data){
                    let remain = data.res.remain
                    let reg_money = data.res.reg_money

                    console.log(remain,reg_money)
                    window.sessionStorage['remain'] = remain
                    window.sessionStorage['reg_money'] = reg_money

                    $(`[lll=${add_people}]`).addClass('active')
                }
            })
            $(`[lll=${add_people}]`).addClass('active')
        }
    })
    // 当点击编辑按钮时
    $('.Shareholder_table').on('click','.edit_table',function(e){
        e.preventDefault()
        let edit_box = $(this).attr('href')
        let edit_id = $(this).closest('tr').attr('data-index')
        if($(this).html()=='编辑'){
            $.ajax({
                url:'/Admin/ComInfo/shareInfo',
                type:'post',
                data:{
                    share_id:edit_id
                },
                success:function(data){
                    let datas = data.res
                    console.log(datas.share_holder)
                    console.log($('#edit_people').find('[add_name=edit_name]'))
                    $('#edit_people').find('[add_name=edit_name]').val(datas.share_holder)
                    $('#edit_people').find('[add_name=edit_precent]').val(datas.share_ratio)
                    $('#edit_people').find('[add_name=edit_money]').val(datas.share_money)
                    // $('#edit_people').find('[add_name=edit_time]').val(datas.share_date)
                    $('#edit_people').find('[add_name=edit_type]').val(datas.share_holder_type)
                    $('#edit_people').addClass('active')
                    window.sessionStorage['edit_id'] = edit_id
                }
            })
        }else{
            let that = this
            $.ajax({
                url:'/Admin/ComInfo/shareDel',
                type:'post',
                data:{
                    share_id:edit_id
                },
                success:function(data){
                    if(data.code==1){
                        $(that).closest('tr').remove()

                        $('#yz_modal').html('删除成功')
                        $('#yz_modal').addClass('active')
                        tipShow()
                        return
                    }else{
                        $('#yz_modal').html('删除失败')
                        $('#yz_modal').addClass('active')
                        tipShow()
                        return
                    }
                }
            })
        }

    })

    $('#add_people').find('[add_name=add_money]').blur(function(){
        let add_money = $(this).val()
        let remain = window.sessionStorage['remain']?window.sessionStorage['remain']:0
        let reg_money = window.sessionStorage['reg_money']?window.sessionStorage['reg_money']:0
        if(parseInt(add_money)>parseInt(remain)){
            $('#yz_modal').html('认缴出资金额不得大于'+remain)
            $('#yz_modal').addClass('active')
            tipShow()
            return
        }else{
            let add_precent = ((add_money/reg_money)*100).toFixed(2)
            $('#add_people').find('[add_name=add_precent]').val(add_precent+'%')
        }

    })
    // 确认并新增按钮点击时
    $('#add_btn').click(function(){
        var add_name = $(this).closest('[lll]').find('[add_name=add_name]').val()
        var add_precent = $(this).closest('[lll]').find('[add_name=add_precent]').val()
        var add_money = $(this).closest('[lll]').find('[add_name=add_money]').val()
        // var add_time = $(this).closest('[lll]').find('[add_name=add_time]').val()
        var add_type = $(this).closest('[lll]').find('[add_name=add_type]').val()
        var add_type_name = $(this).closest('[lll]').find('[add_name=add_type] option:selected').text()

        if(add_name == '' || add_precent == '' || add_money == '' || add_type == ''){
            $('#yz_modal').html('您有内容没有填写完整！')
            $('#yz_modal').addClass('active')
            tipShow()
            return
        }

        let that = this
        $.ajax({
            url:'/Admin/ComInfo/shareAdd',
            type:'post',
            data:{
                share_holder:add_name,
                share_ratio:add_precent,
                share_money:add_money,
                share_date:add_time,
                share_holder_type:add_type
            },
            success:function(data){
                if(data.code==1){
                    let holderHTML = `
                        <tr data-index="${data.res.share_id}">
                            <td>${add_name}</td>
                            <td>${add_precent}</td>
                            <td>${add_money}</td>
                            <td>${add_type_name}</td>
                            <td>
                                <a href="edit_people" class="edit_table">编辑</a>
                                <a href="delete" class="edit_table">删除</a>
                            </td>
                        </tr>
                    `
                    $('#Shareholder_table').children('tbody').append(holderHTML)

                    $(that).closest('[lll]').find('[add_name]').val('')
                    $(that).closest('[lll]').removeClass('active')
                }
            }
        })
    })

    $('#edit_people').find('[add_name=edit_money]').blur(function(){
        let edit_money = $(this).val()
        let remain = window.sessionStorage['remain']?window.sessionStorage['remain']:0
        let reg_money = window.sessionStorage['reg_money']?window.sessionStorage['reg_money']:0
        console.log(edit_money,remain,reg_money)
        if(parseInt(edit_money)>parseInt(remain)){
            $('#yz_modal').html('认缴出资金额不得大于'+remain)
            $('#yz_modal').addClass('active')
            tipShow()
            return
        }else{
            let edit_precent = ((edit_money/reg_money)*100).toFixed(2)
            $('#edit_people').find('[add_name=edit_precent]').val(edit_precent+'%')
        }

    })
    // 保存按钮点击时
    $('#save_btn').click(function(){
        var edit_name = $(this).closest('[lll]').find('[add_name=edit_name]').val()
        var edit_precent = $(this).closest('[lll]').find('[add_name=edit_precent]').val()
        var edit_money = $(this).closest('[lll]').find('[add_name=edit_money]').val()
        // var edit_time = $(this).closest('[lll]').find('[add_name=edit_time]').val()
        var edit_type = $(this).closest('[lll]').find('[add_name=edit_type]').val()
        var edit_type_name = $(this).closest('[lll]').find('[add_name=edit_type] option:selected').text()
        
        if(edit_name == '' || edit_precent == '' || edit_money == '' || edit_type == ''){
            $('#yz_modal').html('您有内容没有填写完整！')
            $('#yz_modal').addClass('active')
            tipShow()
            return
        }

        let edit_id = window.sessionStorage['edit_id']
        let that = this
        $.ajax({
            url:'/Admin/ComInfo/shareModify',
            type:'post',
            data:{
                share_id:edit_id,
                share_holder:edit_name,
                share_ratio:edit_precent,
                share_money:edit_money,
                share_date:edit_time,
                share_holder_type:edit_type
            },
            success:function(data){
                if(data.code==1){
                    let holderHTML = `
                            <td>${edit_name}</td>
                            <td>${edit_precent}</td>
                            <td>${edit_money}</td>
                            <td>${edit_type_name}</td>
                            <td>
                                <a href="edit_people" class="edit_table">编辑</a>
                                <a href="delete" class="edit_table">删除</a>
                            </td>
                    `
                    $('#Shareholder_table').children('tbody').find(`tr[data-index=${edit_id}]`).html(holderHTML)

                    $(that).closest('[lll]').find('[add_name]').val('')
                    $(that).closest('[lll]').removeClass('active')
                }
            }
        })
    })
    // 取消按钮点击时
    $('.button_list').on('click','button',function(){
        if($(this).hasClass('cancel_btn')){
            $(this).closest('[lll]').removeClass('active')
        }
    })

    // 弹出来的小框框
    function tipShow(){
        window.tipBox = setTimeout(function(){
            // $('#yz_modal').removeClass('active')
            // $('#yz_modal').addClass('fadeOut')
            $('#yz_modal').removeClass('active')
            clearTimeout(tipBox)
        },2000)
    }

    //拖动拖动拖动
        let add_box =document.getElementById("add_people");
        let edit_box =document.getElementById("edit_people");
        add_box.onmousedown = function(ev){
            if($(ev.toElement).attr('id')=='add_people'){
                ev =ev ||event;
                let oLeft = add_box.offsetLeft;
                let oTop = add_box.offsetTop;
                let a =ev.clientX-oLeft;
                let b =ev.clientY-oTop;
                add_box.onmousemove =function (ev){
                    ev = ev || event;
                    add_box.style.left =ev.clientX-a+'px';
                    add_box.style.top =ev.clientY-b+'px';
                    $(add_box).css({'cursor':'default'})
                }
            }
            
        }
        edit_box.onmousedown = function(ev){
            if($(ev.toElement).attr('id')=='edit_people'){
                ev =ev ||event;
                let oLeft = edit_box.offsetLeft;
                let oTop = edit_box.offsetTop;
                let a =ev.clientX-oLeft;
                let b =ev.clientY-oTop;
                edit_box.onmousemove =function (ev){
                    ev = ev || event;
                    edit_box.style.left =ev.clientX-a+'px';
                    edit_box.style.top =ev.clientY-b+'px';
                    $(edit_box).css({'cursor':'default'})
                }
            }
        
        }
        document.onmouseup =function(){
            add_box.onmousemove =function(){
                null;
            }
            edit_box.onmousemove =function(){
                null;
            }
        }
        
})